package src.main.danli;

/**
 * 懒汉式单例模式内部类  多线程会破坏此单例模式 改用静态代码块加锁或者内部类
 */
public class IdlerSingleInnerClass {
    private IdlerSingleInnerClass() {
    }
    public static int value=1;

    private static class SingletonHelper{
        private static final IdlerSingleInnerClass INSTANCE = new IdlerSingleInnerClass();

    }

    public static IdlerSingleInnerClass getInstance(){
        value+=1;
        return SingletonHelper.INSTANCE;
    }

}
